import request from '@/utils/request'

const dept = {
  list(params) {
    return request.get('/system/dept/list', {params});
  },
  treeSelectById(id) {
    return request.get(`/system/dept/treeSelectById?id=${id}`)
  },
  treeSelect() {
    return request.get(`/system/dept/treeselect`)
  },
  treeSelectAll() {
    return request.get(`/system/dept/treeSelectAll`)
  },
  treeSelectAllIn() {
    return request.get(`/system/dept/treeSelectAllIn`)
  },
  treeSelectWithUserCount() {
    return request.get(`/system/dept/treeSelectWithUserCount`)
  },
  steUpdateTime(data) {
    return request.post(`/system/dept/steUpdateTime`, data, {timeout: 0})
  },
  listNoScope(params) {
    return request.get('/system/dept/listNoScope', {params});
  },
  selectAllOutDeptList(params) {
    return request.get('/system/dept/selectAllOutDeptList', {params});
  },
  // 获取二级单位数据
  getManagementList(params){
    return request.get('/system/dept/getManagementList', {params});
  },
  isAttributeDept(params){
    return request.get('/system/dept/isAttributeDept', {params});
  },

  getManagerDeptById(id){
    return request.get(`/system/dept/getManagerDeptById/${id}`);
  }

}

// 查询部门列表
export function listDept(params) {
  return request.get('/system/dept/list', {params});
}

// 查询部门列表（排除节点）
export function listDeptExcludeChild(deptId) {
  return request.get(`/system/dept/list/exclude/${deptId}`);
}

// 查询部门详细
export function getDept(deptId) {
  return request.get(`/system/dept/${deptId}`);
}

// 查询部门下拉树结构
export function treeselect() {
  return request.get(`/system/dept/treeselect`);
}

// 查询党组织下拉树结构
export function treeselectParty() {
  return request.get('/system/party/treeselect');
}

// 根据角色ID查询部门树结构
export function roleDeptTreeselect(roleId) {
  return request.get(`/system/dept/roleDeptTreeselect/${roleId}`)
}

// 新增部门
export function addDept(data) {
  return request.post('/system/dept', data)
}

// 修改部门
export function updateDept(data) {
  return request.put('/system/dept', data)
}

// 删除部门
export function delDept(deptId) {
  return request.delete(`/system/dept/${deptId}`)
}

// 4.6.5.评审组树状列表
export function TreeReviewTeam() {
  return request.get(`/kjxm/reviewTeam/tree`)
}

export default dept
